<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>checkbox</title>
    <script type="text/javascript">
        window.onload=function () {
            document.getElementById("btn").onclick=function () {
                createorder();
            }
        }
        function  createorder() {
            aInterest=document.forms[0].interest;
            var sStr="";
            for (var iCv=0;iCv<aInterest.length;iCv++){
                if (aInterest[iCv].checked){
                    sStr += aInterest[iCv].value + " ";
                }
            }

            document.getElementById("interest").value="你的爱好有："+sStr;
        }
    </script>
</head>
<body>
<form>
    <label class="contact"><strong>选择你的爱好：</strong></label><br>
    <input type="checkbox" id="interest1" name="interest" value="网络">
    <label>网络</label>
    <input type="checkbox" id="interest2" name="interest" value="数据库">
    <label>数据库</label>
    <input type="checkbox" id="interest3" name="interest" value="编程">
    <label>编程</label><br>
    <input type="button" id="btn" value="确定"><br>
    <input type="text" id="interest" size="28">
</form>
</body>
</html>